import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/views/components/Layout'

Vue.use(Router)

const router = new Router({
  routes: [
    // 根路径
    // {
    //   path: '/',
    //   redirect: '/home'
    // },
    {
      path: '/',
      name: 'Home',
      meta: { title: '首页' },
      component: () => import(/* webpackChunkName: "home" */ '@/views/home/index')
    },
    {
      path: '/content',
      meta: { title: '' },
      component: Layout,
      children: [
        // {
        //   path: '/content/home',
        //   meta: { title: '主页 ' },
        //   component: () => import(/* webpackChunkName: "feesList" */ '@/views/content/index')
        // },
      //   {
      //     path: '/content/feesList',
      //     meta: { title: '请核对费用清单列表' },
      //     component: () => import(/**webpackChunkName: "feesList" */ '@/views/content/feesList')
      //   },
        {
          path: '/hospitalNum',
          meta: { title: '请输入住院号' },
          component: () => import('@/views/home/hospitalNum')
        },
        {
          path: '/advancePayment',
          meta: { title: '请输入预缴金额' },
          component: () => import('@/views/home/advancePayment')
        },
        {
          path: '/checkPersonalInfo',
          meta: { title: '请核对您的信息' },
          component: () => import('@/views/home/checkPersonalInfo')
        },
      //   {
      //     path: '/content/advancePaymentRecord',
      //     meta: { title: '预交记录' },
      //     component: () => import(/**webpackChunkName: "advancePaymentRecord" */ '@/views/content/advancePaymentRecord')
      //   },
      //   {
      //     path: '/content/listRecord',
      //     meta: { title: '清单记录' },
      //     component: () => import(/**webpackChunkName: "listRecord" */ '@/views/content/listRecord')
      //   },
      //   {
      //     path: '/content/loginType',
      //     meta: { title: '请选择登录方式进行身份校验' },
      //     component: () => import(/* webpackChunkName: "loginType" */ '@/views/content/loginType')
      //   },
        {
          path: '/payMethod',
          meta: { title: '请选择支付方式' },
          component: () => import('@/views/home/payMethod')
        },
        {
          path: '/wechatPay',
          meta: { title: '请使用微信扫码支付' },
          component: () => import('@/views/home/wechatPay')
        },
        {
          path: '/aliPay',
          meta: { title: '请使用支付宝扫码支付' },
          component: () => import(/* webpackChunkName: "aliPay" */ '@/views/home/aliPay')
        },
        {
          path: '/EMICPay',
          meta: { title: '请使用电子医保卡支付' },
          component: () => import(/* webpackChunkName: "EMICPay" */ '@/views/home/EMICPay')
        },
      //   {
      //     path: '/content/EMICPay-info',
      //     meta: { title: '请使用电子医保卡支付' },
      //     component: () => import(/**webpackChunkName: "EMICPayInfo" */ '@/views/content/EMICPayInfo')
      //   },
        {
          path: '/aggregatePay',
          meta: { title: '微信/支付宝/云闪付支付' },
          component: () => import(/* webpackChunkName: "aggregatePay" */ '@/views/home/aggregatePay')
        },
        {
          path: '/searchType',
          meta: { title: '请选择查询类型' },
          component: () => import('@/views/home/searchType')
        },
      //   {
      //     path: '/content/paySuccess',
      //     meta: { title: '缴费成功' },
      //     component: () => import(/* webpackChunkName: "paySuccess" */ '@/views/content/paySuccess')
      //   }
      ]
     }
     ]
  })

router.beforeEach((to, from, next) => {
  document.title = to.meta && to.meta.title || ''
  next()
})

export default router